package com.coolingme.demo.safe;

/**
 * 安全组合模式写法
 *
 * @author wangyue
 * @date 2020-09-19 17:59
 */
public class Test {

    public static void main(String[] args) {
        // 总目录
        Folder dFolder = new Folder("D盘", 1);

        // 办公软件文件夹
        Folder officeFolder = new Folder("办公软件", 2);
        File youdaoyun = new File("有道云笔记.exe");
        File wps = new File("WPS Office.exe");
        officeFolder.add(youdaoyun);
        officeFolder.add(wps);

        // 聊天软件文件夹
        Folder chatFolder = new Folder("聊天软件", 2);
        File qq = new File("QQ.exe");
        File wechat = new File("微信.exe");
        chatFolder.add(qq);
        chatFolder.add(wechat);

        // 在总目录下的文件
        File safe360 = new File("360安全卫士.exe");
        File wangyiMusic = new File("网易云音乐.exe");

        dFolder.add(safe360);
        dFolder.add(wangyiMusic);
        dFolder.add(officeFolder);
        dFolder.add(chatFolder);

        System.out.println("--------文件结构---------");
        dFolder.show();

        System.out.println("\n--------文件列表---------");
        dFolder.list();
    }

}
